package com.mytijian.runtime.resolver;

import java.util.Map;

import com.mytijian.runtime.model.param.AliCommonParam;

public abstract class AliRequestParamResolver <T extends AliCommonParam> {
	
	public T resolver(Map<String, Object> reqParams){
		T param = customResolver(reqParams);
		if (reqParams.get("method") != null) {
			param.setMethod(String.valueOf(reqParams.get("method")));
		}
		if (reqParams.get("timestamp") != null) {
			param.setTimestamp(String.valueOf(reqParams.get("timestamp")));
		}
		if (reqParams.get("sign") != null) {
			param.setSign(String.valueOf(reqParams.get("sign")));
		}
		return param;
	}

	protected abstract T customResolver(Map<String, Object> reqParams);
}
